// 栅格系统
@mixin container {
	margin-right: auto;
	margin-left: auto;
	width: 100%;
	max-width: $container-max-width;
	@include clearfix;
}

@mixin make-row {
	@include clearfix;
}

@mixin make-grid-columns($i: 1, $list: ".#{$ui-name}col-#{$i}, .#{$ui-name}col-sm-#{$i}, .#{$ui-name}col-md-#{$i}, .#{$ui-name}col-lg-#{$i}") {
	@for $i from (1 + 1) through $grid-columns {
		$list: "#{$list}, .#{$ui-name}col-#{$i}, .#{$ui-name}col-sm-#{$i}, .#{$ui-name}col-md-#{$i}, .#{$ui-name}col-lg-#{$i}";
	}

	#{$list} {
		position: relative;
		min-height: 1px;
	}
}

@mixin float-grid-columns($class, $i: 1, $list: ".#{$ui-name}col-#{$class}#{$i}") {
	@for $i from (1 + 1) through $grid-columns {
		$list: "#{$list}, .#{$ui-name}col-#{$class}#{$i}";
	}

	#{$list} {
		float: left;
	}
}

@mixin loop-grid-columns($columns, $class, $type) {
	@for $i from 0 through $columns {
		@include calc-grid-column($i, $class, $type);
	}
}

@mixin calc-grid-column($index, $class, $type) {
	@if ($type==width) and ($index > 0) {
		.#{$ui-name}col-#{$class}#{$index} {
			width: percentage(($index / $grid-columns));
		}
	}

	@if ($type==push) and ($index > 0) {
		.#{$ui-name}col-#{$class}push-#{$index} {
			margin-right: percentage(($index / $grid-columns));
		}
	}

	@if ($type==push) and ($index==0) {
		.#{$ui-name}col-#{$class}push-0 {
			margin-right: auto;
		}
	}

	@if ($type==offset) {
		.#{$ui-name}col-#{$class}offset-#{$index} {
			margin-left: percentage(($index / $grid-columns));
		}
	}
}

// Create grid
@mixin make-grid($class) {
	@include float-grid-columns($class);
	@include loop-grid-columns($grid-columns, $class, width);
	@include loop-grid-columns($grid-columns, $class, push);
	@include loop-grid-columns($grid-columns, $class, offset);
}